package com.example.springmvc.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class CalculateController {
    @RequestMapping(value = "/calc")
    public String clac(Integer num1,Integer num2){
        if(num1 == null || num2 == null){
            log.error("参数残缺！");
            return "参数异常，无法进行计算！<h1><a href='javascript:history.go(-1);'>返回</a>";
        }
        return "<h1> 结果2："+ ( num1 + num2 )+  "</h1><a href='javascript:history.go(-1);'>返回</a>";
    }
}
